﻿using System;
using System.Collections;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for MenuLogin
/// </summary>
public class Menu
{
    private Control hostForm;
	public Menu()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public Control HostForm
    {
        set
        {
            hostForm = value;
        }
    }
    public void SelectAdd()
    {
        if (hostForm.ToString() == "ASP.default_aspx")
            AddMenu1();
        else if (hostForm.ToString() == "ASP.home_aspx")
        {
            AddMenu2();
            AddTopMenu();
        }
        else
        {
            AddMenu2();
            AddTopMenu();
        }
    }

    private void AddMenu1()
    {
        string login = @"
            <div class='login'>
                    UserName:<br />
                    <br />
                    <p>PassWord:<br />
                    <br />
                    <p>Remember me<br /><br /><br /><br />
                    <p><a href=''>Forgot Password?</a><br />
                    <hr />
            </div>";
        hostForm.Controls.Add(new LiteralControl(login));
    }
    private void AddMenu2()
    {
        hostForm.Controls.Add(new LiteralControl(@"
            <div class='menu'>
               Hello, <b>"+ HttpContext.Current.Session["UserName"] + @"</b>
               <pre>Profile:           <a href='home.aspx'>>>Edit</a>
               <p>Last Sync:         
10/27/2008    22.30
                   <a href='home.aspx'>>>sync now</a>
               </pre>
            </div>
            
            "));
    }
    private void AddTopMenu()
    {
        hostForm.Controls.Add(new LiteralControl(@"
            <div class='topMenu'>
                <pre><a href='home.aspx'>Home</a>"+
                @"          <a href='contact.aspx'>Contact</a>"+
                @"          <a href='calendar.aspx'>Calendar</a>"+
                @"          <a href='mail.aspx'>Mail</a>

                </pre>
            </div>
            "));

    }
}
